<?php
declare (strict_types = 1);

namespace app\admin\controller;

//use think\facade\Request;
//use think\facade\Db;
use think\facade\Request;
use think\facade\View;
class Brand
{
    public function brand()
    {
        //接值

//
        $keywords= Request::get('keywords','','trim,htmlspecialchars,strip_tags');
        $recommended= Request::get('recommended','2','trim,htmlspecialchars,strip_tags');
        $logo= Request::get('logo',[],'trim,htmlspecialchars,strip_tags');
        $data = [
            'keywords'    =>$keywords,
            'recommended' =>$recommended,
            'logo'        =>$logo,
        ];
//        $logo = implode(",",$logo);
          //1接参，过滤
//          $data= Request::get('','','trim,htmlspecialchars,strip_tags');

          //2.调用模型类获取数据
          $list = \app\admin\model\Brand::getBrand($data,$data);
          //3.模板赋值
          View::assign($data);

          //4.模板渲染
        return View::fetch('',['list'=>$list]);
    }


    public function pinpaiadd()
    {
        if (Request::isPost()){
            $postParam = Request::post('','','trim,htmlspecialchars,strip_tags');

            $Brandadd= new \app\admin\model\Brand();
            $db = $Brandadd->add($postParam);

            if($db){
                echo '成功'.$db;
            }else{
                echo '错误!'.$Brandadd->getError();
            }
        }else{
            return View::fetch();
        }

    }

}
